import java.util.*;
/*给你一个整数数组 arr 。请你返回和为 奇数 的子数组数目。
由于答案可能会很大，请你将结果对 10^9 + 7 取余后返回。*/
public class Text1 {
    public static int seek(int[] arr) {
        int n = arr.length;
        int mod = 1000_000_007;
        long count = 0;
        int[] nums = new int[n + 1];
        int t1 = 0, t2 = 0;
        //记录前缀和，奇数和偶数的数目
        for (int i = 0; i < n; i++) {
            nums[i + 1] = (arr[i] + nums[i]) % 2;
        }
        for (int x : nums) {
            if (x % 2 == 0) {
                t2++;
            } else t1++;
        }
        count =(long) t1 * t2 % mod;
        return (int)count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int result = seek(arr);
        System.out.println(result);
    }
}